<?php
defined( '_VALID_MOS' ) or die('<script>window.location.href="http://www.kinifurniture.com";</script>');

$functions->is_login();
if($sumbitREG)
{
	$no_id=$_SESSION['SESSIONUSERID'];
	$qry1="select * from anggota where email='$inp_email' and user_id!='$no_id'";
	$TOTAL_RECORDSET1=$dbh->num_rows($dbh->query($qry1));

	if ($TOTAL_RECORDSET1>0) $error_message='<font color="red">( Email address already exists ) !!!</font>';
	else 
	{



		$qrySavePage="update anggota set 
					password='$inp_password',
					nama='$inp_name',
					tav_number='$inp_tav',
					perus='$inp_company',
					alamat1='$inp_address',
					zipcode='$inp_zip',
					kota='$inp_city',
					negara='$inp_country',
					email='$inp_email',
					telp='$inp_telp',
					fax='$inp_fax',
					newsletter='$inp_newsletter'
					where user_id=$no_id";
		$result=$dbh->query($qrySavePage);
		if($result)
		{
			echo '<script>location.href="./index.php?show=message&msg=upd01";</script>';
		}
		else
			echo '<script>location.href="./index.php?show=message&msg=upd02";</script>';
	}
}
	$qry12="select * from anggota where user_id='".$_SESSION['SESSIONUSERID']."'";
	$total_row12=$dbh->query($qry12);
	if(@mysql_num_rows($total_row12)>0)
		$Data1=@mysql_fetch_object($total_row12);	

	$no_id=$_SESSION['SESSIONUSERID'];
	$val_username=$Data1->username;
	$val_password=$Data1->password;
	$val_password2=$Data1->password;
	$val_name=$Data1->nama;
	$val_tav=$Data1->tav_number;
	$val_company=$Data1->perus;
	$val_address=$Data1->alamat1;
	$val_city=$Data1->kota;
	$val_zip=$Data1->zipcode;
	$val_country=$Data1->negara;
	$val_email=$Data1->email;
	$val_telp=$Data1->telp;
	$val_fax=$Data1->fax;
	if ($Data1->newsletter=='Y') $val_check1='checked="checked"'; else $val_check2='checked="checked"';
?>